package om.recorder;


import ohos.media.audio.AudioCapturer;
import ohos.media.audio.AudioStreamInfo;

/**
 * @author Kailash Dabhi
 * @date 01 July, 2017 12:34 PM
 */
final class MinimumBufferSize {
    private final int minimumBufferSize;

    MinimumBufferSize(AudioRecordConfig audioRecordConfig) {
        this.minimumBufferSize = AudioCapturer.getMinBufferSize(audioRecordConfig.frequency(),
                AudioStreamInfo.getChannelCount(audioRecordConfig.channelPositionMask()), audioRecordConfig.audioEncoding().getValue());
    }

    int asInt() {
        return minimumBufferSize;
    }
}
